﻿using BBICMS.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;

namespace BBICMS.Model
{
    public class LinkCategory : AuditableEntity<int>
    {
    

        [Display(Name = "分类名称")]
        [Required(ErrorMessage = "请输入分类名称")]
        public string Title { get; set; }
        public int? ParentCategoryId { get; private set; }

        [ForeignKey("ParentCategoryId")]
        public LinkCategory ParentCategory { get; set; }

        [Display(Name = "排序")]
        [Required(ErrorMessage = "请输入排序")]
        [RegularExpression(@"^-?\d*$", ErrorMessage = "格式不正确")]
        public int Importance { get; set; }

         [Display(Name = "激活")]
        public bool Active { get; set; }
      

        public List<LinkCategory> SubCategories { get; set; }
        public ICollection<Link> Links { get; set; }
        public LinkCategory()
        {
            this.Links = new List<Link>();
            this.SubCategories = new List<LinkCategory>();
        }
    }
}
